package net.qiqbframework.event.dao.mfimpl;

import com.mybatisflex.core.query.QueryWrapper;
import net.qiqbframework.eventsourcing.dao.DomainEventProcessDao;
import net.qiqbframework.eventsourcing.dao.DomainEventRecordPo;
import net.qiqbframework.mf.BasicEntityPoDaoMfImpl;


import java.util.List;

public class DomainEventProcessDaoMfImpl extends BasicEntityPoDaoMfImpl<DomainEventProcessMapper, DomainEventRecordPo> implements DomainEventProcessDao {

    @Override
    public List<DomainEventRecordPo> listByEventIdAndListenerId(String applicationName, String eventId, String listenerId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper
                .eq(DomainEventRecordPo::getApplicationName, applicationName)
                .eq(DomainEventRecordPo::getHandlerDescription, listenerId)
                .eq(DomainEventRecordPo::getEventId, eventId);
        return super.list(queryWrapper);
    }

    @Override
    public DomainEventRecordPo getPoById(String id) {
        return super.getById(id);
    }
}
